#include<iostream>
using namespace std;
int a,b;
int main()
{
	while(cin>>a>>b){
	    while(a!=b){
	    	if(a>b)a/=2;
	    	else b/=2;
        }
    	cout<<a<<endl;
	}
	return 0;
}
